<?php
////第一个版本
////前台
//class Secretary {
//    private $observer;
//    private $action;
//
//    public function Attach(StockObserver $observer){
//        $observer[] = $observer;
//    }
//
//    public function Notify(){
//        foreach($this->observer as $observer){
//            $observer.update();
//        }
//    }
//}

////同事类
//class StockObserver{
//    private $name;
//    private $secretary;
//
//    public function __construct($name,$secretary)
//    {
//        $this->name = $name;
//        $this->secretary = $secretary;
//    }
//
//    public function update(){
//        echo '关闭股票行情';
//    }
//}

//第二个版本
abstract class Observer{
    protected $name;
    protected $secretary;

    public function __construct($name,$secretary)
    {
        $this->name = $name;
        $this->secretary = $secretary;
    }

    abstract public function update();
}

class StockObserver extends Observer{
    public function update()
    {
        // TODO: Implement update() method.
    }
}


